home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cgazv5n5.arc / XMS.H < prev    next >
C/C++ Source or Header  |  1991-09-23  |  3KB  |  109 lines

  1. /*--- XMS.H ------------------------------ Listing 2 -----
  2.  * XMS definitions and related information
  3.  *
  4.  * by David Babcock
  5.  *
  6.  * Validated for Microsoft and Borland C/C++
  7.  *
  8.  * (c) 1991 C Gazette. Object Code may be used freely,
  9.  * source code may be used if authorship and publication
  10.  * are acknowledged.
  11.  *-------------------------------------------------------*/
  12.  
  13. #if __TURBOC__
  14. #define CDECL
  15. #else
  16. #define asm _asm
  17. #define CDECL _cdecl
  18. #endif
  19.  
  20. typedef void (far *pfv)( void );  /* needed by Microsoft */
  21.  
  22. struct xms_struc_type
  23. {
  24.     unsigned int ret_dx ;
  25.     unsigned int ret_bx ;
  26.     pfv func ;
  27. } ;
  28.  
  29. union uoffset
  30. {
  31.     void far *p;
  32.     unsigned long o;
  33. };
  34.  
  35. /*---------------------------------------------------------
  36.  * The definition for the following structure copies the one
  37.  * in the XMS specification, for ease of reference.
  38.  * This structure must be fully packed - do not let the
  39.  * compiler pad it. For MSC, this means the #pragma pack(1)
  40.  * directive is needed.
  41.  *-------------------------------------------------------*/
  42. #if !defined(__TURBOC__)
  43. #pragma pack(1) /* no packing */
  44. #endif
  45. struct ExtMemMoveStruct
  46. {
  47.     unsigned long Length ;
  48.     unsigned int  SourceHandle ;
  49.     union uoffset SourceOffset ;
  50.     unsigned int  DestHandle ;
  51.     union uoffset DestOffset ;
  52. } ;
  53.  
  54. #if !defined(__TURBOC__)
  55. #pragma pack() /* revert to default packing */
  56. #endif
  57.  
  58. extern int    EMBhandle;
  59. extern struct xms_struc_type xms_struc;
  60. extern struct ExtMemMoveStruct XMSMoveStruct;
  61.  
  62. /*---- far pointer macros ----*/
  63.  
  64. #if !defined(MK_FP)
  65. #define MK_FP(seg,off) \
  66.     (void far*)((((unsigned long)(seg))<<16)|(off))
  67. #endif
  68.  
  69. #if !defined(FP_SEG)
  70. #define FP_SEG(p) ((unsigned int)((p)>>16))
  71. #endif
  72.  
  73. #if !defined(FP_OFF)
  74. #define FP_OFF(p) ((unsigned int)(p)
  75. #endif
  76.  
  77. /*---------------------------------------------------------
  78.  * The following #define specifies the earliest version
  79.  * acceptable for the memory manager to operate.
  80.  *-------------------------------------------------------*/
  81.  
  82. #define MIN_XMS_VER 0x200
  83.  
  84. /* Prototypes in xmsgen and called by XMSUMB, XMSEMB, XMSHMA */
  85.  
  86. unsigned long XMSfunction(unsigned, unsigned, unsigned );
  87. void          closeXMS ( void );
  88. int           initXMS ( void );
  89. unsigned int  basicXMSfunction ( unsigned, unsigned, unsigned );
  90. unsigned long dxbxXMSfunction ( unsigned, unsigned );
  91. int           GetXMSVersionNumber ( void );
  92. int           RequestHighMemoryArea ( unsigned );
  93. int           ReleaseHighMemoryArea ( void );
  94. int           GlobalEnableA20 ( void );
  95. int           GlobalDisableA20( void );
  96. int           LocalEnableA20 ( void );
  97. int           LocalDisableA20 ( void );
  98. int           QueryA20 ( void );
  99. unsigned long QueryFreeExtendedMemory ( void );
  100. int           AllocateExtendedMemoryBlock ( unsigned );
  101. int           FreeExtendedMemoryBlock ( unsigned );
  102. int           MoveExtendedMemoryBlock ( void far *p );
  103. unsigned long LockExtendedMemoryBlock ( unsigned );
  104. int           UnlockExtendedMemoryBlock ( unsigned int );
  105. unsigned long GetEMBHandleInformation ( unsigned );
  106. int           ReallocateExtendedMemoryBlock(unsigned, unsigned);
  107. int           RequestUpperMemoryBlock ( unsigned );
  108. int           ReleaseUpperMemoryBlock ( unsigned );
  109. char          *PrintXMSVersionNumber ( unsigned );